package pl.javarsovia.javarsovia4android.util;

import android.app.Activity;
import android.view.View;
import android.widget.Button;
import pl.javarsovia.javarsovia4android.menu.ButtonCommand;

/**
 * @author mateusz.grzechocinski@gmail.com
 * @since 2010-06-06
 */
public class UIEventsBinder {

	private Activity activity;

	public UIEventsBinder(Activity activity) {
		this.activity = activity;
	}

	public void bindOnClickEvent(final ButtonCommand buttonCommand) {
		Button button = (Button) activity.findViewById(buttonCommand.getButtonResId());
		button.setEnabled(true);
		button.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View view) {
				buttonCommand.buttonClicked();
			}
		});
	}
}
